package com.lizhi.note.mapper;


import com.lizhi.note.dto.NotebookDTO;
import com.lizhi.note.entity.NotebookEntity;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper(componentModel = "spring")
public interface NotebookMapper {

    NotebookMapper INSTANCE = Mappers.getMapper(NotebookMapper.class);

    NotebookDTO toDto(NotebookEntity entity);

    NotebookEntity toEntity(NotebookDTO dto);

    @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
    void updateEntity(NotebookDTO dto, @MappingTarget NotebookEntity entity);

    // 列表转换方法
    List<NotebookDTO> toDtoList(List<NotebookEntity> entities);

    List<NotebookEntity> toEntityList(List<NotebookDTO> dtos);
}
